<?php
use bank\Bank;
use bank\BankUtils;
use people\Person;
use people\Client;
use products\BankProduct;
use products\Credit;
use products\Deposit;
use products\ConsumerCredit;
use products\HomeCredit;
use products\LongDeposit;
use products\ShortDeposit;
use loader\SplClassLoader;

require 'loader/SplClassLoader.php';
$loader = new SplClassLoader();
$loader->register();

try {

	
$unicredit = new Bank("Unicredit", "Sv.Nedelya", 15000);
$clients = array();

$peter = new Client("Peter", "Sofia", 100, 650);
$clients[] = $peter;
$simeon = new Client("Simeon", "Sofia", 150, 1500);
$clients[] = $simeon;
$lora = new Client("Lora", "Panagyurishte", 250, 800);
$clients[] = $lora;
$nedyalko = new Client("Nedyalko", "Plovdiv", 50, 450);
$clients[] = $nedyalko;
$ivan = new Client("Ivan", "Varna", 10, 450);
$clients[] = $ivan;
$maria = new Client("Maria", "Varna", 15, 390);
$clients[] = $maria;
$zornitsa = new Client("Zornitsa", "Sofia", 235, 800);
$clients[] = $zornitsa;
$nikolay = new Client("Nikolay", "Pleven", 850, 2500);
$clients[] = $nikolay;
$pencho = new Client("Pencho", "Burgas", 1000, 4500);
$clients[] = $pencho;
$atanas = new Client("Atanas", "Sandanski", 47.5, 799);
$clients[] = $atanas;

echo $unicredit;

foreach($clients as $client) {
	
	$percent = rand(8,10);
	$percent = $percent*10;
	$depositAmount = $client->getCash()*($percent/100);
	$client->openDeposit("ShortDeposit", $depositAmount, $unicredit);
}

echo $unicredit;

foreach($clients as $client) {

	$creditAmount = rand(100,500);
	$creditPeriod = rand(1,60);
	$client->askForCredit("ConsumerCredit", $creditAmount, $creditPeriod, $unicredit);

}

foreach($clients as $client) {

	echo $client;
	
}

echo $unicredit;

} catch (Exception $e) {
	
	echo $e->getMessage();
}